import { SwfFrames } from "../scene/modle/frames/SwfFrames";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
type int = number;
//class FrameTypeConfig
    
    export  class FrameTypeConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._nameMap = new Map<any, any> /* flash.utils.Dictionary */();
            if (FrameTypeConfig._instance != null) 
            {
                throw new Error(" FrameTypeConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc5=0;
            var loc6=arg1.modle;
            for(loc4 of loc6) 
            {
                loc1 = new SwfFrames(loc4.frameType, loc4.name);
                loc1.createAction(loc4);
                this._map[loc1.frameType + "_" + loc1.type] = loc1;
                this._nameMap[loc1.name] = loc1;
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getObjectByFileName("frameType.xml");
            this.write(loc1);
            return;
        }

        public getFramesByType(arg1: string, arg2: int=0): SwfFrames
        {
            return this._map[arg1 + "_" + arg2];
        }

        public getFramesByName(arg1: string): SwfFrames
        {
            return this._nameMap[arg1];
        }

        public static get instance(): FrameTypeConfig
        {
            if (FrameTypeConfig._instance == null) 
            {
                FrameTypeConfig._instance = new FrameTypeConfig();
            }
            return FrameTypeConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_nameMap: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: FrameTypeConfig;
    }
